import request from '@/config/axios'

// 设备报废 VO
export interface AssetScrapVO {
  id: number // 编号
  eamId: number // 设备id
  eamName: string // 设备名称
  assetCode: string // 资产编号
  scrapTime: Date // 报废时间
  reason: string // 报废原因
  status: number // 状态
}

// 设备报废 API
export const AssetScrapApi = {
  // 查询设备报废分页
  getAssetScrapPage: async (params: any) => {
    return await request.get({ url: `/eam/asset-scrap/page`, params })
  },

  // 查询设备报废详情
  getAssetScrap: async (id: number) => {
    return await request.get({ url: `/eam/asset-scrap/get?id=` + id })
  },

  // 新增设备报废
  createAssetScrap: async (data: AssetScrapVO) => {
    return await request.post({ url: `/eam/asset-scrap/create`, data })
  },

  // 修改设备报废
  updateAssetScrap: async (data: AssetScrapVO) => {
    return await request.put({ url: `/eam/asset-scrap/update`, data })
  },

  // 删除设备报废
  deleteAssetScrap: async (id: number) => {
    return await request.delete({ url: `/eam/asset-scrap/delete?id=` + id })
  },

  // 导出设备报废 Excel
  exportAssetScrap: async (params) => {
    return await request.download({ url: `/eam/asset-scrap/export-excel`, params })
  },
}